//
//  inputTableViewController.m
//  tableview
//
//  Created by 宋 on 15/11/19.
//  Copyright © 2015年 宋. All rights reserved.
//

#import "inputTableViewController.h"

@interface inputTableViewController ()<UITextFieldDelegate>
{
    //NSArray *data;
    UITextField *tf;
}
@end

@implementation inputTableViewController

- (void)viewDidLoad {
    /*[super viewDidLoad];
    data = @[
             @[@"家庭住址:",@"湖南省永州市"],
             @[@"电话号码:",@"15200411916"]
             ];
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
    self.title = @"详细信息";*/
    
    [super viewDidLoad];
    self.title = @"编辑";
    tf = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
    tf.text = self.tel;
    tf.delegate = self;
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [tf becomeFirstResponder];
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    [self.delegate inputFinshed:textField.text];
    return YES;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
   
    [cell addSubview:tf];
    return cell;

}

/*- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return data.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [data[section] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    
    UITextField *tf = [[UITextField alloc] initWithFrame:cell.bounds];
    
    tf.text = data[indexPath.section][indexPath.row];
    [cell.contentView addSubview:tf];

    return cell;
}*/
    
    /*[cell addSubview:tf];
    return cell;*/


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
